package cc.web.vaaking.common;

import lombok.Data;

@Data
public class AjaxResult {
    private int code;
    private String msg;
    private Object data;

    public AjaxResult(){}

    public AjaxResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public AjaxResult(int code, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static AjaxResult success( Object data) {
        return new AjaxResult(1,"",data);
    }

    public static AjaxResult error( String msg) {
        return new AjaxResult(0,msg,null);
    }

    public static AjaxResult error(String msg, Object data) {
        return new AjaxResult(0,msg,data);
    }
}
